from time import sleep

from selenium import  webdriver

from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.implicitly_wait(5)
driver.get("http://192.168.1.138/ranzhi/www/sys/index.html")
driver.maximize_window()
driver.find_element(By.XPATH, '//*[@id="account"]').send_keys("admin")
driver.find_element(By.XPATH, '//*[@id="password"]').send_keys("123456")
driver.find_element(By.XPATH, '//*[@id="submit"]').click()
driver.find_element(By.XPATH,'//*[@id="s-menu-superadmin"]/button/i').click()
#框架切入
driver.switch_to.frame("iframe-superadmin")#进入框架iframe-superadmin
driver.find_element(By.XPATH,'//*[@id="shortcutBox"]/div/div[1]/div/a/h3').click()
from selenium.webdriver.support.select import Select
#定位到下拉框
ele = driver.find_element(By.ID,"role")
#创建 下拉框对象
sle_obj=Select(ele)
#调用 方法
# sle_obj.select_by_index(2) #根据索引
# sle_obj.select_by_visible_text("研发")  #根据文本内容
sle_obj.select_by_value("office")   #根据value的值 在源代码中查看
driver.find_element(By.ID,"account").send_keys("zhaoyun")
driver.find_element(By.ID,"realname").send_keys("赵云")
driver.find_element(By.ID,"genderm").click()
driver.find_element(By.ID,"password1").send_keys("123456")
driver.find_element(By.ID,"password2").send_keys("123456")
driver.find_element(By.ID,"email").send_keys("l28666666@gmail.com")
driver.find_element(By.ID,"submit").click()
sleep(2)
driver.switch_to.parent_frame()#返回上一级框架

driver.find_element(By.LINK_TEXT,"签退").click()
sleep(2)

# driver.switch_to.default_content() #返回根框架
# sleep(2)
# 导入

